# coding=utf-8
'''
Created on 2011-5-23

@author: tie
'''
#中文注释？ 难道中文注释和 python3还有冲突..?
aa=2,3,5,6
bb=1,4
#aa=[1,3]
#bb=[2]
#aa=[3]
#bb=[2]
def merge(arr1,arr2):
    
    n = len(arr1)+len(arr2)
#    arr3 = [0 for i in range(n)]
    arr3 = []
    
    index_a = 0
    index_b = 0
    
    for i in range(n):
        a=arr1[index_a]
        b=arr2[index_b]
        
        
        if(a<=b):
            arr3.append(a)
            index_a+=1
        else:
            arr3.append(b)
            index_b+=1
        
        #处理还有剩余的那个集合
        if(index_a==len(arr1) or index_b==len(arr2)):
            
            #如果下标冒了 给还原回去
            if(index_a==len(arr1)):
                index_a -= 1
            if(index_b==len(arr2)):
                index_b -= 1
                
            if(arr1[index_a]>arr2[index_b]):
                arr = arr1
                index = index_a
            else:
                arr = arr2
                index = index_b
            
            for j in range(index,len(arr)):
                arr3.append(arr[j])
            
            break
            
    return arr3

print(merge(aa, bb))


        
        
        
        
            
        
    